package com.sesame.controller;

import com.sesame.framework.cache.config.MySerialNumber;
import kim.sesame.framework.serial.define.ISerialNumberService;
import kim.sesame.common.web.controller.AbstractWebController;
import kim.sesame.common.result.ApiResult;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

@CommonsLog
@RestController
@RequestMapping("/test")
public class TestController extends AbstractWebController {

//    @Autowired
//    private DistributedLocker locker;
    @Autowired
    private ISerialNumberService serialNumberService;


    @RequestMapping("/getNo1")
    public ApiResult getNo1() {

        String no1 = serialNumberService.generateSerialNumber(MySerialNumber.QAS_HEADLESS_CODE);
        log.info("no1:" + no1);

        return success(Arrays.asList(no1));
    }

    @RequestMapping("/getNo2")
    public ApiResult getNo2() {

        String no2 = serialNumberService.generateSerialNumber(MySerialNumber.QAS_ARBITRATION_CODE);
        log.info("no2:" + no2);

        return success(Arrays.asList(no2));
    }


}
